<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
?>
<style>
	.booleandata td
	{
		font-size: 8pt;
		font-family: verdanaa, tahoma, arial, sans serif;
		border-bottom: 1px solid #ddd;
	}
	.booleandata thead
	{
		text-align: left;
		background-color: #bbb;
		border: 1px solid #333;
	}
	
	.booleandata .time
	{
		background-color: #ddd;
		padding: 5px;
	}
	
	.booleantitle
	{
	    font-size: 12pt;
		border-bottom: 1px solid #aaa;
		padding-bottom: 5px;
	}
	
	.nonbooleantitle
	{
		font-size: 12pt;
		border-bottom: 1px solid #aaa;
		padding-bottom: 5px;
	}
	
	.booleanrange
	{
	    font-size:9pt;
	}
</style>
<?

$aTitle = array(
"Last Hour",
"Last 24 Hours",
"Last 3 Days",
"Last 1 Week",
"Last 1 Month",
"Last 6 Months",
"Last 1 Year",
"Arbitrary"
);

if ($_REQUEST["type"] == "")
{
	$_REQUEST["type"] = 2;
}

switch ($_REQUEST["type"])
{
	case 1:
		$sTitle = $aTitle[0];
		$nStartTime = time()-86400;
		$nEndTime = time();
		$sType = "";
		$nType = 1;
		break;
	case 2:
		$sTitle = $aTitle[1];
		$nStartTime = time()-86400;
		$nEndTime = time();
		$sType = "";
		$nType = 2;
		break;
	case 3:
		$sTitle = $aTitle[2];
		$nStartTime = time()- (86400 * 3);
		$nEndTime = time();
		$sType = "bool15";
		$nType = 3;
		break;
	case 4:
		$sTitle = $aTitle[3];
		$nStartTime = time()- (86400 * 7);
		$nEndTime = time();
		$sType = "bool15";
		$nType = 4;
		break;
	case 5:
		$sTitle = $aTitle[4];
		$nStartTime = time()- (86400 * 30);
		$nEndTime = time();
		$sType = "bool60";
		$nType = 5;
		break;
	case 6:
		$sTitle = $aTitle[5];
		$nStartTime = time()- (86400 * 30 * 6);
		$nEndTime = time();
		$sType = "bool180";
		$nType = 6;
		break;
	case 7:
		$sTitle = $aTitle[6];
		$nStartTime = time()- (86400 * 365);
		$sType = "bool180";
		$nType = 7;
		break;
	case 8:
		$sTitle = $aTitle[7];
		if ($_REQUEST["startDate"] != "")
		{
			$nStartTime = strtotime($_REQUEST["startDate"]);
			$nStartTime = $nStartTime + ($_REQUEST["startHour"]*3600) - (5*60);
		}
		
		if ($_REQUEST["endDate"] != "")
		{
			$nEndTime = strtotime($_REQUEST["endDate"]);
			$nEndTime = $nEndTime + ($_REQUEST["endHour"]*3600) + (5*60);
		}
		
		if ($nStartTime > $nEndTime)
		{
			$nStartTime = 0;
			$nEndTime = 0;
		}
		$sType = "bool15";
		$nType = 8;
		break;
	default:
		$sTitle = $aTitle[7];
		$nStartTime = time()-86400;
		$sType = "";
		$nType = 2;
		break;
}
?>
<div class="booleantitle"><b><?=$sTitle;?></b><br>
	<span class="booleanrange">
	
	<?
	$k=1;
	foreach ($aTitle as $sTitleString)
	{
		if ($sTitleString == $sTitle)
		{
			$aLinkString[] = '<span style="color: #ccc">'.$sTitleString."</span>";
		}
		else
		{
			$sQueryString = preg_replace("/&type=[0-9]/", "", $_SERVER["QUERY_STRING"]);
			$aLinkString[]="<a href=\"".$_SERVER["PHP_SELF"]."?$sQueryString&type=$k\">$sTitleString</a>";
		}
			
		$k++;
	}
	
	echo join($aLinkString, " - ");
	?>
	</span></div>
<?

include($_SERVER["DOCUMENT_ROOT"]."/server/arbitrary.inc");

if ($bNotShow != true)
{
	
	include("servergroupboolhistory.inc");
	include("servergroupgraphhistory.inc");
}

?>

	
	
